<script setup lang="ts">
import useStore from "@/store";
import router from "@/router";
import * as echarts from "echarts";
import { onMounted } from "vue";
//进入到script里组件开始渲染
onMounted(() => {
  // 基于准备好的dom，初始化echarts实例
  var myChart = echarts.init((document as any).getElementById("main-bar"));
  // 绘制图表
  myChart.setOption({
    title: {
      text: "ECharts 入门示例",
    },
    tooltip: {},
    xAxis: {
      type: "category",
      data: ["A", "B", "C"],
    },
    yAxis: {
      type: "value",
    },
    series: [
      {
        data: [120, 200, 150],
        type: "line",
      },
    ],
  });
  //onMounted DOM渲染用户已经可以看到渲染完成的页面
});

const store = useStore();
</script>

<template>
  <div id="main-bar"></div>
</template>
<style scoped>
#main-bar {
  width: 100%;
  height: 500px;
}
</style>
